package com.copyctrl.campus.portal.service.Impl;

import com.copyctrl.campus.portal.service.AddressService;
import com.copyctrl.mapper.CampAddressMapper;
import com.copyctrl.model.CampAddress;
import com.copyctrl.model.CampAddressExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:JH
 * @version:1.0
 */
@Service
public class AddressServiceImpl implements AddressService {

    @Autowired
    CampAddressMapper mapper;

    @Override
    public int addAddress(CampAddress address) {
        return mapper.insert(address);
    }

    @Override
    public int deleteAddress(Integer address) {
        return mapper.deleteByPrimaryKey(address);
    }

    @Override
    public List<CampAddress> findAllCampAddresses(Integer uid) {
        CampAddressExample campAddressExample = new CampAddressExample();
        campAddressExample.createCriteria().andUidEqualTo(uid);
        return mapper.selectByExample(campAddressExample);
    }
}
